public class nwork1 {
    public class ErrorHandle {
        public static void main(String[] args) {
            ErrorHandle errorHandle = new ErrorHandle();
            // ---------------------Begin------------------------
            //捕获errorSrc对象中divideTest方法中的除零异常（ArithmeticException）,获取异常信息可以使用getMessage方法
            try{
                errorHandle.divideTest();
            }
            catch (ArithmeticException e){
                System.out.println("Exception Messaage:"+e.getMessage());
            }
            finally {
                System.out.println("/ by zero");
                System.out.println("成功捕获除零异常");
            }
        }
        public void divideTest() {
            try {
                int result = 0 / 1;
            }
            catch (ArithmeticException e) {
                System.out.println("Exception Message: " + e.getMessage());
                throw e;
            }
        }
    }


